// Enesea Script Interface
// (c) jimon game studio

#ifndef JEH_JESCRIPTINTERFACE
#define JEH_JESCRIPTINTERFACE

#include "jeScriptInterface.h"
#include "IScriptManager.h"
#include <iostream>

#include "ILogManager.h"
#include "IVariables.h"
#include "ISceneNode.h"
#include "ISerializeStream.h"
#include "IFpsCounter.h"
#include "jeEngineController.h"

namespace je
{
	namespace core
	{
		void Script_Log(jeStringc & msg)
		{
			JELOG(msg)
		}

		f32 GetDT()
		{
			return JEDT32;
		}

		void RegisterScriptInterface()
		{
			JE_SCRIPT_REG_FUNCTION(StopEngine,"void StopEngine()")

			JE_SCRIPT_REG_FUNCTION(Script_Log,"void Log(stringc & in)")

			JE_SCRIPT_REG_CLASS(IVariables)
			JE_SCRIPT_REG_CLASS_METHOD_PR(IVariables,void,SetVariable,(const jeStringc&,c8),"void SetVariable(stringc & name,int8 value)")
			JE_SCRIPT_REG_CLASS_METHOD_PR(IVariables,void,SetVariable,(const jeStringc&,s32),"void SetVariable(stringc & name,int value)")
			JE_SCRIPT_REG_CLASS_METHOD_PR(IVariables,void,SetVariable,(const jeStringc&,s32),"void SetVariable(stringc & name,uint value)")
			JE_SCRIPT_REG_CLASS_METHOD_PR(IVariables,void,SetVariable,(const jeStringc&,f32),"void SetVariable(stringc & name,float value)")
			GetScriptManager()->RegisterGlobalVariable("IVariables @ Variables",GetVariablesPointer());

			JE_SCRIPT_REG_CLASS(ISerializeStream)
			JE_SCRIPT_REG_CLASS_METHOD(ISerializeStream,OpenSection,"void OpenSection(stringc & name)")
			JE_SCRIPT_REG_CLASS_METHOD(ISerializeStream,CloseSection,"void CloseSection()")
			//JE_SCRIPT_REG_CLASS_METHOD_PR(ISerializeStream,void,OnValue,(const jeStringc&,c8*,const c8&),"void OnValue(stringc&,int8,int8)") // TODO
			//JE_SCRIPT_REG_CLASS_METHOD_PR(ISerializeStream,void,OnValue,(const jeStringc&,s32*,const s32&),"void OnValue(stringc&,int,int)") // TODO
			//JE_SCRIPT_REG_CLASS_METHOD_PR(ISerializeStream,void,OnValue,(const jeStringc&,f32*,const f32&),"void OnValue(stringc&,float,float)") // TODO

			using namespace scene;
			JE_SCRIPT_REG_CLASS(ISceneNode)
			JE_SCRIPT_REG_CLASS_METHOD(ISceneNode,SetPosition,"void SetPosition(vector3&in,bool)")
			JE_SCRIPT_REG_CLASS_METHOD(ISceneNode,GetPosition,"vector3 & GetPosition()")
			JE_SCRIPT_REG_CLASS_METHOD(ISceneNode,SetRotation,"void SetRotation(vector3&in,bool)")
			JE_SCRIPT_REG_CLASS_METHOD(ISceneNode,GetRotation,"vector3 & GetRotation()")
			JE_SCRIPT_REG_CLASS_METHOD(ISceneNode,SetScale,"void SetScale(vector3&in,bool)")
			JE_SCRIPT_REG_CLASS_METHOD(ISceneNode,GetScale,"vector3 & GetScale()")

			JE_SCRIPT_REG_FUNCTION(GetDT,"float GetDT()")
			
		}
	}
}

#endif
